Collections, sets and types
نویسنده
چکیده
We give a rst order formulation of Church's type theory in which types are mere sets. This formulation is obtained by replacing -calculus by a language of combinators (skolemized comprehension schemes), introducing a distinction between propositions and their contents, relativizing quanti ers and at last replacing typing predicates by membership to some sets. The theory obtained this way has both a type theoretical avor and a set theoretical one. Like set theory, it is a rst order theory, and it uses only one notion of collection. Like type theory, it gives an explicit notation for objects, a primitive notion of function and propositions are objects. Key-words: type, set, type theory, set theory (R esum e : tsvp) [email protected] Unit e de recherche INRIA Rocquencourt Domaine de Voluceau, Rocquencourt, BP 105, 78153 LE CHESNAY Cedex (France) T el ephone : (33 1) 39 63 55 11 { T el ecopie : (33 1) 39 63 53 30 Collections, ensembles et types R esum e : Nous donnons une formulation au premier ordre de la th eorie des types de Church, dans laquelle les types sont des ensembles ordinaires. Cette formulation est obtenue en rempla cant le -calcul par un langage de combinateurs (sch emas de compr ehension skol emis e), en introduisant une distinction entre les propositions et leurs contenus, en relativisant les quanti cateurs et en n en rempla cant les pr edicats de typage par l'appartenance a des ensembles. La th eorie ainsi obtenue pr esente a la fois des aspects de th eorie des types et des aspects de th eorie des ensembles. Comme la th eorie des ensembles, c'est une th eorie du premier ordre et elle repose sur une unique notion de collection. Comme la th eorie des types, elle fournit une notation explicite pour les objets, une notion primitive de fonction et les propositions sont des objets. Mots-cl e : type, ensemble, th eorie des types, th eorie des ensembles Collections, sets and types 3 Introduction A set is a collection of objects de ned by a characteristic property of its elements, for instance \the set of natural numbers lower than or equal to 3". At a rst glance, a type is also a collection of objects de ned by a characteristic property of its elements, for instance \the type of natural numbers". A di erence between the notions of set and type lies in the fact that a given object usually belongs to only one type while it may belong to several sets. For instance, the type of 0 is nat (the type of natural numbers) while 0 belongs to several sets fx j x 3g, fx j x = 0g, fx j 9y x = 2 yg, etc. Also the fact that a given object belongs to a type is often a decidable judgement, while the fact that a given object belongs to a set is usually not. At last, the type of an expression restricts its use. For instance, as 0 has type nat and true has type bool, the proposition 0 0 is well-formed and the proposition true true is not. Thus a postulate underlying the use of (simply) typed languages is that among all the properties veri ed by an object, a single one, its type, determines the uses of this object. In many situations this postulate seems to be too restrictive. For instance, the expression pa is de ned when a is a positive real number and 1=a is de ned when a is non zero complex number. Thus more liberal type disciplines have been designed (overloading, polymorphism, subtyping, etc.) For instance, we may consider the types complex, real, non-zero and positive, non-zero and real being subtypes of complex and positive being a subtype of real. When such extensions are considered, unicity of type is lost and decidability sometimes also. Moreover there seems to be very few di erences between the judgement \1 belongs to the type positive" and the proposition \1 2 R+". There is a conceptual di culty to explain why type and set are two distinct notions and it seems that types should be mere sets. This advocates for founding mathematics on a theory with a single notion of collection, such as set theory, rather than one with two distinct notions, such as type theory. Another reason advocating for set theory are that it is a rst order theory while type theory is not. At last, for abstract mathematics set theory is better suited than type theory. If we develop, for instance, results about groups in type theory, we cannot apply these results both to the group of integers and to the group of bijective functions mapping integers to integers, because when we develop these results, we need to give a xed type to the elements of the group. This problem is usually solved by using \typical ambiguity" i.e. more or less type variables. However, in some situations, type theory is better suited than set theory. For instance, proofs-as-objects interpretations are always developed in typed languages [8, 34, 21, 22, 12]. Also when one is interested in expressing computations as rewrite rules on the expressions of the language, type theories seem better suited than set theories [34, 21, 22, 12]. At last automated theorem proving methods have been developed for type theory [3, 28, 29] and very rarely for set theory. Several reasons explain these success of type theory. (1) Type theory provides an explicit notation for objects ( -calculus) while set theory merely provides axioms expressing the existence of some objects. (2) Functions are primitive objects in type theory and the object obtained by applying a function to some object has a notation, while it has not in set theory as functions are coded as relations. (3) Meaningless statements such as 1 2 0 are forbidden by the syntax of type theory but not by the one of set theory. (4) Typing judgements are decidable in type theory (this fact is used in the functional interpretation of proofs, as proofs judgements must be decidable). (5) Propositions are objects in type theory and not in set theory (with the exception of Morse's set theory [39]). We give in this paper a rst order formulation of Church's theory of types where types are mere sets. This theory is obtained by rst considering a formulation with combinators (skolemized comprehension schemes) instead of -calculus [14], introducing a distinction between propositions and their contents, relativizing quanti ers as in [20, 15, 42] and at last replacing the typing predicates by belongness to some sets. The theory obtained this way has both a type theoretical and a set theoretical avor. Like set theory, there is only one notion of collection, the theory is expressed in a rst order setting and typical ambiguity is not required. Like type theory, it provides an explicit notation for objects, functions are primitive objects and propositions are objects. The decidability of typing judgements can be seen as the decidability of a fragment of the language. The formation of meaningless propositions is not yet forbidden as this requirement RR n 2708 4 Gilles Dowek is incompatible with the expression in a rst order setting, we suggest at the end of the paper an extension of rst order logic that would allow to forbid the formation of these propositions. This formulation permits to simplify the proofs of Henkin's completeness theorem and of a variant of Miller's higher order skolemization theorem. 1 Typed rst order logic 1.1 Syntax De nition A typed rst order language (see [20] for a detailed presentation) is given by a denumerable collection T of types, for each type T of T , a denumerably in nite collection VT of variables, such that if T 6= U then VT and VU are disjoint, a denumerable collection of function symbols, to each function symbol f is associated an element of T n+1 (n 0) called its rank, a denumerable collection of predicate symbols, to each predicate symbol P is associated an element of T n (n 0) called its rank. De nition Terms of type T are inductively de ned as variables of VT are terms of type T , if f is a function symbol of rank (T1; :::; Tn; Tn+1) and t1, ..., tn are terms of type T1; :::; Tn then (f t1 ::: tn) is a term of type Tn+1. De nition Propositions is inductively de ned as if P is a predicate symbol of rank (T1; :::; Tn) and t1, ..., tn are terms of type T1; :::; Tn then (P t1 ::: tn) is a proposition, >, ? are propositions (resp. truth and falsehood), if A is a proposition then :A is a proposition, if A and B are propositions then A ^B, A _ B, A) B, A, B are propositions, if A is a proposition and x a variable then 8x A and 9x A are propositions. 1.2 Proofs Proof rules for typed rst order logic are the same as the ones for rst order logic, with an extra side condition for quanti ers rules, that a variable of type T can only be substituted by a term of type T . Natural deduction, sequent calculus and Frege-Hilbert systems can be used. We give below a formulation of natural deduction. As usual substitution is de ned in such a way that variable captures are avoided. De nition (Substitution) x[x b] = b, y[x b] = y, Inria Collections, sets and types 5 (f c1 ::: cn)[x b] = (f c1[x b] ::: cn[x b]), (P c1 ::: cn)[x b] = (P c1[x b] ::: cn[x b]), >[x b] = >, ?[x b] = ?, (:A)[x b] = :(A[x b]), (A ^B)[x b] = (A[x b]) ^ (B[x b]), (A _ B)[x b] = (A[x b]) _ (B[x b]), (A) B)[x b] = (A[x b])) (B[x b]), (A, B)[x b] = (A[x b]), (B[x b]), (8y A)[x b] = 8z (A[y z][x b]) where z is a fresh variable, i.e. a variable not occurring in 8x A or b, (9y A)[x b] = 9z (A[y z][x b]) where z is a fresh variable, i.e. a variable not occurring in 9x A or b. De nition (Proof rules) A 2 axiom ` A A ` B ) -intro ` A) B ` A) B ` A) -elim ` B A ` B B ` A, -intro ` A, B ` A, B ` A, -elim ` B ` A, B ` B , -elim ` A ` A ` B ^-intro ` A ^ B ` A ^ B ^-elim ` A ` A ^ B ^-elim ` B ` A _-intro ` A _ B ` B _-intro ` A _ B ` A _ B A ` C B ` C _-elim ` C A ` ? :-intro ` :A ` A ` :A :-elim ` ? RR n 2708 6 Gilles Dowek >-intro ` > ` ? ?-elim ` A ` A 8-intro x not free in ` 8x A ` 8x A 8-elim x and t have the same type ` A[x t] ` A[x t] 9-intro x and t have the same type ` 9x A ` 9x A A ` B 9-elim x not free in B or in ` B classic ` A _ :A where is a nite set of propositions and A, B and C are propositions. 1.3 Models De nition A model M for typed rst order logic based on a collection T of types is given by a family (MT )T2T of non empty sets, for each function symbol f of type (T1; :::; Tn; Tn+1) a function f̂ from MT1 ::: MTn to MTn+1 , for each predicate symbol P of type (T1; :::; Tn) a subset P̂ of MT1 ::: MTn . De nition Let M be a model, an assignment onto M is function ' associating to each variable x of VT an element of MT . If ' is an assignment, x a variable of VT and a an element of MT , we write ' + (x; a) for the assignment such that (y) = a if y = x and (y) = '(y) otherwise. De nition Let M be a model and ' an assignment, we de ne a function ' that associates to each term of type T an element of MT and to each proposition an element of f0; 1g. '(x) = '(x), '(f t1 ::: tn) = f̂('(t1); :::; '(tn)), '(P t1 ::: tn) = 1 if ('(t1); :::; '(tn)) is in P̂ and 0 otherwise, '(>) = 1, '(?) = 0, '(:A) = 1 if '(A) = 0 and 0 otherwise, '(A ^ B) = 1 if '(A) = '(B) = 1 and 0 otherwise, '(A _ B) = 1 if '(A) = 1 or '(B) = 1 and 0 otherwise, '(A) B) = 1 if '(A) = 0 or '(B) = 1 and 0 otherwise, '(A, B) = 1 if '(A) = '(B) and 0 otherwise, '(8x A) = 1 if for every a in MT (where T is the type of x), '+ (x; a)(A) = 1 and 0 otherwise, '(9x A) = 1 if there exists a in MT (where T is the type of x) such that '+ (x; a)(A) = 1 and 0 otherwise. Inria Collections, sets and types 7 De nition A model M is a model of a proposition A (A is valid in M) if '(A) = 1 for every assignment '. A model is a model of a set of propositions if it is a model of each proposition of . Theorem (Completeness) has a model if and only if 6 `? [26, 46, 20]. Corollary ` A if and only if every model of is a model of A. 2 Set theory and type theory 2.1 Na ve set theory 2.1.1 Functions and predicates In a rst order language, individual symbols denote elements of the domain, predicate symbols denote sets of elements of the domain and function symbols denote functions over the domain. More expressions denoting elements of the domain can be built as terms. Facts concerning all the elements of the domain or some unspeci ed elements of the domain can be expressed using variables and quanti ers. But, it is impossible to construct expressions denoting more sets of elements of the domain, or more functions over the domain than the ones given as primitive symbols. It is also impossible to express facts concerning all (or some unspeci ed) sets of elements of the domain or all (or some unspeci ed) functions over the domain. For instance, in rst order arithmetic we cannot express the proposition Every non empty set of natural numbers has a greatest lower bound Any rst order theory can be extended with sets and functions. A set is written fx1; :::; xn j Pg where x1; :::; xn are variables and P is a proposition, in the same way a function is written x1; :::; xn 7! t where x1; :::; xn are variables and t is a term. In this extension, variables may denote arbitrarily elements of the domain, sets of elements of the domain, functions over the domain, and also sets of sets, sets of functions, functions over sets, functions over functions, etc. Any term can be understood as denoting an individual, a set or a function of arbitrary arity, thus the notion of arity is lost, also is the distinction between individual symbols, function symbols and predicate symbols which are replaced by a single syntactical category of primitive symbols. De nition Terms and propositions are inductively de ned as variables are terms, primitive symbols are terms, if f is a term and a1; :::; an are terms then (f a1 ::: an) is a term. if P is a proposition and x1; :::; xn are variables then fx1; :::; xn j Pg is a term, if t is a term and x1; :::; xn are variables then x1; :::; xn 7! t is a term. If P is a term and a1; :::; an are terms then (P a1 ::: an) is a proposition, > and ? are propositions, if A is a proposition then :A is a proposition, if A and B are propositions then A ^B, A _ B, A) B, A, B are propositions, if A is a proposition and x a variable then 8x A and 9x A are propositions. RR n 2708 8 Gilles Dowek De nition The tems of the form fx1; :::; xn j Pg and x1; :::; xn 7! t are called abstractions. De nition (Substitution) x[x b] = b, y[x b] = y, (c d)[x b] = (c[x b] d[x b]), (y1; :::; yn 7! c)[x b] = z1; :::; zn 7! (c[y1 z1]:::[yn zn][x b]) where z1; :::; zn are fresh variables, i.e. variables not occurring in y1; :::; yn 7! c or b, fy1; :::; yn j Pg[x b] = fz1; :::; zn j (P [y1 z1]:::[yn zn][x b]g where z1; :::; zn are fresh variables, i.e. variables not occurring in fy1; :::; yn j Pg or b, >[x b] = >, ?[x b] = ?, (:A)[x b] = :(A[x b]), (A ^B)[x b] = (A[x b]) ^ (B[x b]), (A _ B)[x b] = (A[x b]) _ (B[x b]), (A) B)[x b] = (A[x b])) (B[x b]), (A, B)[x b] = (A[x b]), (B[x b]), (8y A)[x b] = 8z (A[y z][x b]) where z is a fresh variable, i.e. a variable not occurring in 8x A or b, (9y A)[x b] = 9z (A[y z][x b]) where z is a fresh variable, i.e. a variable not occurring in 9x A or b. To the axioms already present in the the rst order theory, we add axioms expressing the replacement of formal arguments of a set or a function by the actual ones (conversion axioms) and axioms de ning the equality of two sets or two functions (extensionality axioms). We take the universal closure of the following propositions. Conversion: 8x1 ::: 8xn (fx1; :::; xn j Pg x1 ::: xn), P 8x1 ::: 8xn ((x1; :::; xn 7! t) x1 ::: xn) = t Extensionality: 8f 8g (8x1 ::: 8xn (f x1 ::: xn) = (g x1 ::: xn))) f = g 8P 8Q (8x1 ::: 8xn (P x1 ::: xn), (Q x1 ::: xn))) P = Q Deduction rules are the usual ones. De nition Na ve set theory is the extension of the rst order theory of equality with functions and sets. We do not take any kind of mathematical objects (numbers, etc.) as primitive as once we have sets and functions we can construct internally all the mathematical objects we need. Thus we take as axioms the universal closure of the following propositions. Conversion: 8x1 ::: 8xn (fx1; :::; xn j Pg x1 ::: xn), P 8x1 ::: 8xn ((x1; :::; xn 7! t) x1 ::: xn) = t Extensionality: 8f 8g (8x1 ::: 8xn (f x1 ::: xn) = (g x1 ::: xn))) f = g 8P 8Q (8x1 ::: 8xn (P x1 ::: xn), (Q x1 ::: xn))) P = Q Equality: 8x (x = x) 8a 8b (a = b)) (P [x a]) P [x b]) Inria Collections, sets and types 9 2.1.2 The Comprehension schemes In the presentation of a theory we can either choose to give notations for objects and axioms expressing the properties of these objects, or to give axioms expressing the existence of objects verifying the desired properties. For instance, relations with a maximal element can either be de ned by the language , M and the axiom 8x (x M) or by the language and the axiom 9y 8x (x y) From the second formulation we can produce the rst by skolemizing the axioms (in this case we skolemize the external existential quanti er of the axiom). In the same way instead of having an explicit notation for sets and functions, we can merely state axioms expressing their existence (comprehension schemes). We take as axioms the universal closure of the following propositions. 9A 8x1 ::: 8xn ((A x1 ::: xn), P ) where A is not free in P , 9f 8x1 ::: 8xn ((f x1 ::: xn) = t) where f is not free in t. If we skolemize these axioms we get primitive symbols that roughly look like the terms x1; :::; xn 7! t and fx1; :::; xn j Pg. The comprehension schemes roughly become 8x1 ::: 8xn ((fx1; :::; xn j Pg x1 ::: xn), P ) 8x1 ::: 8xn (((x1; :::; xn 7! t) x1 ::: xn) = t) which are more or less the conversion axioms [6]. There are however some di erences between the theory obtained by skolemizing the comprehension schemes and the theory based on the full notation 7!, f j g. First, as abstractions are primitive symbols in the skolemized language, there is no substitution under abstractions. Then, when we skolemize the comprehension schemes, we get symbols x1; :::; xn 7! t and fx1; :::; xn j Pg only for terms t and propositions P that do not contain further abstractions, i.e. there is no nested abstractions. So the equivalence of the these two formulations is not a mere consequence of Skolem's theorem. For na ve set theory the equivalence of these formulations is trivial (since, as we shall see, both formulations are inconsistent). For set theory and type theory, studied below, the equivalence is proved in [14] (slight adaptation of the proof of [14] is needed for type theory as formulated below). Skolemizing the comprehension schemes gives a presentation of the theory with an explicit notation for objects, but this notation is closer to a language of combinators than to the full notation 7!, f j g. 2.1.3 Flattening In a rst order language, in a term of the form (f a1 ::: an), f is a function symbol, thus this term can be de ned as a tree whose root is labeled by the symbol f and whose sons are a1; :::; an. In na ve set theory, we cannot look at the term (f a1 ::: an) as a tree whose root is labeled by f , as f is also a term. So we de ne this term as a tree whose root is labeled by a symbol n and whose sons are f; a1; :::; an. Such a term is better written ( n f a1 ::: an). In the same way, a proposition (P a1 ::: an) is better written (2n P a1 ::: an). This way, primitive symbols (i.e. individual symbols, function symbols and predicate symbols of the initial language) are individual symbols (i.e. zero-ary function symbols) in this new language, while the only (non zero-ary) function symbols and predicate symbols are n and 2n. Remark With the comprehension schemes (or the skolmemized comprehension schemes) and the symbols n and 2n, na ve set theory is formulated in a rst order language. RR n 2708 10 Gilles Dowek But this rst-order language is very di erent from the rst-order language we started with. If we started, for instance, with rst order arithmetic, the symbols 0, S and were respectively an individual symbol, a unary function symbol and a binary predicate symbol. They are now all individual symbols. In rst order arithmetics, the domain of the language contains only natural numbers, now it contains all together natural numbers, sets, functions, functions of functions, etc. There are two ways to extend a rst order theory. Either we keep the same universe of the discourse and we extend the logic to speak about sets of elements of this universe and functions over this universe, or we extend the universe of the discourse including sets and functions and we keep the same logic. Flattening permits to shift from the rst choice to the second. 2.1.4 Currying Instead of having a notion of function of n variables, we can have only functions of one variable and de ne a function of n variables f as a function mapping an object a to the function of n 1 variables x2; :::; xn 7! (f a x2 ::: xn). The term ( n f a1 ::: an) is now written ( 1 ::: ( 1 f a1) ::: an) and if we have the notation 7!, the term x1; :::; xn 7! t is written x1 7! (::: xn 7! t). (The language obtained this way is called -calculus.) In the same way a predicate (set) of n variables can be de ned as a function mapping an object a to the predicate of n 1 variables fx2; :::; xn j (P a x2 ::: xn)g. The proposition (2n A a1 ::: an) is now written 20 ( 1 ::: ( 1 A a1) ::: an) and if we have the notation f j g, the term fx1; :::; xn j Pg is then written x1 7! ::: 7! xn 7! fPg. Notice that P is a proposition and fPg is a term. The object fPg is the content (lexis) of the proposition P . In contrast, when we consider the comprehension schemes or the skolemized comprehension schemes, we cannot restrict ourselves to unary schemes that are strictly weaker than the n-ary ones [14]. Let us write for 1 and " for 20. The axioms are then rephrased as the universal closure of the following propositions. Comprehension: 9A 8x1 ::: 8xn ((" ( ::: ( A x1) ::: xn)), P ) where A is not free in P , 9f 8x1 ::: 8xn (( ::: ( f x1) ::: xn) = t) where f is not free in t. Extensionality: 8P 8Q ((" P ), (" Q))) (P = Q) 8f 8g (8x ( f x) = ( g x))) (f = g) Equality: 8x (x = x) 8a 8b (a = b)) (P [x a]) P [x b]) where (a = b) is an abbreviation for (" ( ( = a) b)). Remark We could go one step further and identify the proposition (" a) with the term a and the term fPg with the proposition P . 2.1.5 Russell's paradox Na ve set theory is inconsistent as we can derive the proposition (" (fx j:(x x)gfx j:(x x)g)), :(" (fx j:(x x)gfx j:(x x)g)) and thus the proposition ?. Inria Collections, sets and types 11 The mechanisms of na ve set theory can be presented as follows propositions abstraction #" application objects The abstraction mechanism permits to form objects from propositions (for instance, from the proposition x 3, we form the object fx j x 3g), and the application mechanism permit to form propositions using objects (for instance, from fx j x 3g and 2, we form (" ( fx j x 3g 2))). Thus to weaken na ve set theory and make it consistent, one can either weaken the downarrow (and get set theory) or weaken the uparrow (and get type theory). 2.2 Set theory In set theory we consider only sets and sets have only one argument. The proposition (21 P a) is written a 2 P . Equality is a predicate symbol (not a primitive symbol), thus there are no primitive symbols. The de nitions above are restated as follows. De nition Terms are variables. De nition Propositions are inductively de ned as if a and b are terms then a = b is a proposition, if a and b are terms then a 2 b is a proposition, > and ? are propositions, if A is a proposition then :A is a proposition, if A and B are propositions then A ^B, A _ B, A) B, A, B are propositions, if A is a proposition and x a variable then 8x A and 9x A are propositions. The comprehension scheme 9X 8a (a 2 X , P ) is still powerful enough to express Russell's paradox, so we restrict it to four instances: the subset scheme (or restricted comprehension), the power set axiom, the union axiom and the pairing axiom. We keep the extensionality and equality axioms. De nition The axioms of set theory are the universal closure of the following propositions. Subset: 8y 9X 8z ((z 2 X), ((z 2 y) ^ P )) where X and y are not free in P . Power set: 8x 9X 8y ((y 2 X), 8z ((z 2 y)) (z 2 x))) Union: 8x 9X 8y ((y 2 X), 9z ((y 2 z) ^ (z 2 x))) Pairing: 8x 8y 9X 8z ((z 2 X), ((z = x) _ (z = y))) Extensionality: 8P 8Q (8x (x 2 P ), (x 2 Q))) (P = Q) RR n 2708 12 Gilles Dowek Equality: 8x (x = x) 8a 8b (a = b)) (P [x a]) P [x b]) Remark Set theory is a rst order theory. Remark These axioms are Zermelo's axioms, they can be extended to Zermelo-Fraenkel by adding the replacement scheme. Other extensions are the Von Neuman-Godel-Bernays set theory and Morse's set theory. 2.3 Type Theory The other way to weaken na ve set theory is to weaken the rule that permits to form the term ( a b) whatever the terms a and b are. Thus we add types to na ve set theory and get a typed rst order theory. 2.3.1 Higher order languages and type theory De nition Types are inductively de ned as is a type, o is a type, if T and U are types then T ! U is a type. De nition A higher order language is a typed rst order language based on this set of types and containing function symbols T;U of rank (T ! U; T; U), a predicate symbol " of rank (o) and some individual symbols of rank (T ) for some type T . These individual symbols are called primitive symbols. Thus, terms of type T are thus inductively de ned as variables of type T are terms of type T , primitive symbols of type T are terms of type T , if f is a term of type T ! U and a is a term of type T then ( T;U f a) is a term of type U . In the same way, propositions are inductively de ned as if t is a term of type o then (" t) is a proposition, > and ? are propositions, if A is a proposition then :A is a proposition, if A and B are propositions then A ^B, A _ B, A) B and A, B are propositions, if A is a proposition and x a variable of type T then 8x A and 9x A are propositions. De nition (Type theory) Type theory is a theory in the higher order language containing the primitive symbols =T of type T ! T ! o. The axioms are the universal closure of the following propositions. Comprehension: 9A 8x1 ::: xn (" ( Tn;o ::: ( T1;T2!:::!Tn!o A x1) ::: xn)), P ) 9f 8x1 ::: xn ( Tn;U ::: ( T1;T2!:::!Tn!U f x1) ::: xn)) =U t Inria Collections, sets and types 13 Extensionality: 8P 8Q ((" P ), (" Q))) (P =o Q) 8f 8g (8x ( T;U f x) =U ( T;U g x))) (f =T!U g) Equality: 8x (x =T x) 8a 8b (a =T b)) (P [x a]) P [x b]) where (a =T b) is an abbreviation for (" ( T;o ( T;T!o =T a) b)). Remark In the comprehension schemes, we can either consider that all the variables free in P (resp. t) are among x1; :::; xn (closed schemes) or not (open schemes). In the second case, we take the universal closure of the instances of the schemes to have closed axioms. As shown in [14], these formulations are equivalent. From now on, we consider only the instances of the schemes such that all the variables free in P (resp. t) are among x1; :::; xn. Remark The de nition of type theory comes in two steps. First we de ne the notion of higher order language that can be compared to the notion of rst order language. Then we de ne type theory that is a set of axioms expressed in a higher order language and that one can compare to any rst order theory, such as arithmetic. A higher order language permits to introduce set variables and function variables and to quantify over these variables. It does not assert which sets and which functions we are talking about. One could for instance consider a theory such that every function is constant. In type theory the comprehension schemes state the existence of some sets and functions. To have more sets and functions, the descriptions axioms or the axiom of choice are usually added to these axioms [6]. Remark (Avoiding axiom schemes) In set theory comprehension schemes are indexed by propositions. In type theory, they are indexed by propositions (or terms), and also by types. It is possible to avoid this indexing by propositions and terms. In set theory, this is done in the Von Neuman-Godel-Bernays set theory. In type theory, the situation is simpler because, for each type, the comprehension schemes are equivalent to a nite number of their instances. 9k 8x 8y (k x y) = x 9s 8x 8y 8z (s x y z) = (x z (y z)) Indeed the combinators K and S are su cient to express all the -terms and all the logical constants can be expressed from equality [25, 2]. The simplicity of this expression (compared to set theory) is due to the fact that propositions are objects in type theory, while they are not in set theory. 2.3.2 Models of type theory and general models A higher order language is a typed rst order language, with function symbols T;U , a predicate symbol " and individual symbols (primitive symbols). Thus, a model of a higher order language is given by a family MT of non empty sets, a family of functions AT;U from MT!U MT to MU , denotations of T;U , a subset Y of Mo, denotation of ", for each primitive symbol of type T an element of MT , (for instance, for the language of type theory, an element ET of MT!T!o for every type T , denotation of =T ). RR n 2708 14 Gilles Dowek Proposition (Completeness) A proposition A is derivable in a theory , if and only if it is valid in every model of . Proof As a consequence of the completeness theorem for typed rst order languages. Corollary 1 A proposition A is derivable in type theory, if and only if it is valid in every model of type theory. Corollary 2 (Completeness of type theory) A proposition A is derivable in type theory from a set of axioms , if and only if it is valid in every model of type theory that is a model of . Remark Let be a theory and C be the class of models of . We have ` A if and only if A is valid in all the models of C. Subclasses C 0 of C may share this property with C. For instance, in rst order logic with equality, provable propositions are characterized either by the class of all models of the equality axioms, but also by the class of equality models i.e. models where equality denotes equality in the model. We exhibit now a class of models (the class of general models) that is smaller than the class of all models of type theory, but is still such that a proposition is derivable in type theory if and only if it is valid in every general model. De nition A model is an equality model if (AT;o(AT!o;o(ET ; a); b) is in Y ) if and only if a = b in the model. Proposition Equality models are models of the equality axioms. Remark There are models of the axiom of equality that are not equality models [5]. Proposition For every model M of the equality axioms there exists an equality model M0 such that the propositions valid in M and in M0 are the same. Proof We let M 0 T =MT = where a b if and only if AT;o(AT;T!o(ET ; a); b) is in Y . If a is an element of MT we write ~ a for the class of a in M 0 T . The functions AT;U are compatible with the relation because the proposition 8f 8g 8x 8y ((f = g) ^ (x = y))) (( T;U f x) = ( T;U g y)) is a consequence of the equality axioms. Thus we can de ne the denotation of T;U as ~ AT;U the function mapping ~ a and ~b to ~ AT;U (a; b). If a and b are two elements of Mo and a b, then a and b are either both in Y or both not in Y because 8x 8y (x = y)) ((" x), (" y)) is a consequence of the equality axioms. Thus we can de ne the denotation of " as the set ~ Y containing the elements of M 0 o containing elements of Y . By induction over terms structure, the denotation of any term in M 0 T is the class of its denotation in MT and, by induction over propositions structure, the denotation of a proposition in M 0 T is its denotation in MT . In the following we study only equality models of the axioms of type theory. Proposition Let M be an equality model. The model model M is a model of the axioms 8x 8y ("(x), "(y))) (x = y) 9a "(a), > 9b "(b), ? if and only if Mo has two elements and Y as one element. Inria Collections, sets and types 15 Proof The model M is a model of the axiom 8x 8y ("(x), "(y))) (x = y) if and only if for every a and b in Mo, if a and b are both in Y or both not in Y then AT;o(AT;T!o(ET ; a); b) is in Y As this model is a equality model then this condition can be rephrased if a and b are both in Y or both not in Y then a = b In other words Y has at most one element and Mo Y has at most one element A model M is a model of the axioms 9a "(a), > 9b "(b), ? if and only if Y has at least one element and Mo Y also. Thus M is a model of these axioms if and only if Mo has two elements and Y as one element. De nition A a model is functional if the elements of MT!U are functions from MT to MU and AT;U (f; g) = f(g). Proposition Equality functional models are models of the extensionality axiom 8f 8g (8x ( f x) = ( g x))) (f = g) Proof Let M be a equality functional model, we want to show that M is a model of the extensionality axiom i.e. for every a and a0 in MT!U if (for every b in MT , AU;o(AU;U!o(EU ; AT;U (a; b)); AT;U (a0; b)) is in Y ) then AT!U;o(AT!U;(T!U)!o(ET!U ; a); a0) is in Y . As M is an equality model this condition can be rephrased if (for every b in MT , AT;U (a; b) = AT;U (a0; b)) then a = a0 As M is a functional model this condition can be rephrased if (for every b in MT , a(b) = a0(b)) then a = a0 which is true as a and a0 are functions from MT to MU . Remark There are equality models of the extensionality axiom that are not functional. Proposition For every equality model M of the extensionality axiom there exists an equality functional model M0 such that the propositions valid in M and in M0 are the same. Proof By induction over type structure we construct a set M 0 T and a bijection T from MT to M 0 T . We let M 0 = M , (x) = x, M 0 o = Mo, o(x) = x. Then we assume that M 0 T , M 0 U , T and U are de ned and we de ne M 0 T!U and T!U . We de ne the function from MT!U to the set of functions from M 0 T to M 0 U as (a)(b) = U (AT;U (a; 1 T (b)) is injective as if (a) = (a0) then for every b in M 0 T , (a)(b) = (a0)(b) RR n 2708 16 Gilles Dowek thus for every b in M 0 T , U (AT;U (a; 1 T (b)) = U (AT;U (a0; 1 T (b))) thus for every c in MT , U (AT;U (a; 1 T ( T (c))) = U (AT;U (a0; 1 T ( T (c)))) i.e. for every c in MT , U (AT;U (a; c)) = U (AT;U (a0; c)) then, as U is injective, for every c in MT , (AT;U (a; c) = (AT;U (a0; c)), as M is an equality model of the extensionality axiom we get a = a0. We let M 0 T!U = (MT!U ) and T!U = . Then we let Y 0 = Y , E0 T (a; b) = 1 if a = b and E0 T (a; b) = 0 otherwise, and A0T;U (a; b) = a(b). We prove by induction over term structure that for every term a we have '(a) = ('(a)). Then we prove by induction over proposition structure that for every proposition, P we have '(P ) = '(P ). Thus P is valid in M0 if and only if it is valid in M. De nition A model is closed by explicit de nitions if it is a model of the comprehension schemes. De nition A model is a general model ([24]) if it is an equality model, Mo has two elements and Y has one, MT!U contains functions from MT to MU , it is closed by explicit de nitions. Proposition For every modelM of type theory there exists a general model M0 such that the propositions valid in M and in M0 are the same. Corollary 1 A proposition is valid in every general model if and only if it is provable in type theory. Corollary 2 (Completeness of type theory) A proposition A is derivable in type theory from a set of axioms , if and only if it is valid in every general model that is a model of . Remark There are models of type theory that are not general models. First only equality models (and not all the models of the equality axioms) are general models. Then only functional models (and not all the models of the extensionality axiom) are general models. Remark The rst condition (the model is an equality model) is forgotten in [24] and is added in [5]. This condition is important because if we do not take it, the other conditions do not imply the validity of the axioms. In particular, a non equality functional model need not be a model of the extensionality axiom [5]. Remark The proof of Henkin's completeness theorem above is slightly simpler than the usual one [24, 6]. First, we do not need to re-do the work of Godel's completeness theorem, but we use this theorem instead. Then, the fact that every equality model of the extensionality axiom can be turned into an equality functional model is a lemma here and its proof is usually mixed with the proof of the completeness theorem. Remark In Henkin's de nition [24], the condition that a general model needs to be closed by explicit de nitions is stated as the fact that every -term has a denotation. This condition is a quite strong requirement [27] as the notion of general model is dependent of the considered language which is undesirable. Instead of taking a presentation of type theory based on -calculus we can take one based on the comprehension schemes. Then this condition can be rephrased as the fact that the model is a model of the comprehension schemes [32, 13, 7, 15]. This condition is still dependent of the language as an axiom scheme is a set of axiom indexed by expressions of the language. But now, the same critic to Henkin's models holds for models of (for instance) Peano's arithmetic, as this theory is also expressed using an axiom scheme, and thus a model of this theory cannot be de ned independently of the language. Another equivalent condition stated in [4, 5] Inria Collections, sets and types 17 using the fact that, for each type, the comprehension schemes are equivalent to a nite number of their instances. This condition is independent of the language. Remark In Henkin's de nition [24], the fact that the elements of MT!U are functions from MT to MU is part of the de nition of the notion of model. Thus the extensionality axiom is in some sense built in the de nition of models. The idea of taking arbitrary elements in MT!U (and thus functions for AT;U that are not mere function application) comes from [15, 19]. Also the fact that Mo has two elements is part of this de nition and thus the axiom 8x 8y ("(x), "(y))) (x = y) is also built in this de nition. Thus, the usual de nition of models mixes up two di erent questions: (1) What is a model of a higher order language ? (2) What is a model of type theory ? In rst order model theory, we are used to distinguish between a model of a rst order language and a model of a speci c theory. These two questions get di erent answers here. A model of a higher order language is given by a family of sets MT , a family of function AT;U , a subset Y of Mo and denotations for the primitive symbols of the language. A model of type theory is a model of its axioms. Remark For a presentation of type theory based on the skolemized comprehension schemes (combinators), we have the same de nition as for the presentation with the non-skolemized comprehensions schemes, but we need to take in the de nition of the model a denotation for each Skolem's symbol and the condition that the model must be a model of the skolemized comprehension schemes instead of the non-skolemized ones. General models can be de ned as above. For a presentation of type theory based on -calculus, we can use the translation of the theory based on -calculus to the one based on the skolemized comprehension schemes [14] and de ne the denotation of a term as the denotation of its translation. Then have the equivalence: P is provable in the theory based on -calculus if and only if P 0, the translation of P , is provable in the theory based on the skolemized comprehension schemes, if and only if P 0 is valid in every model of type theory, if and only if P is valid in every model of type theory. In a general model, the denotation of -terms and propositions can be de ned directly by '(x) = '(x), if u is a term of type T ! U and v of type T then '(u v) = '(u)('(v)), if u is a term of type T then '(x 7! u) is the function f of MT!U such that for all d 2 MT , f(d) = '+ (x; d)(u), this function is in MT!U . if P is a proposition then '(fPg) is the unique element of Y if '(P ) = 1 and the unique element of Mo Y otherwise. '(" t) = 1 if '(t) is in Y and 0 otherwise. '(>) = 1, '(?) = 0, '(:A) = 1 if '(A) = 0 and 0 otherwise, '(A ^ B) = 1 if '(A) = '(B) = 1 and 0 otherwise, '(A _ B) = 1 if '(A) = 1 or '(B) = 1 and 0 otherwise, '(A) B) = 1 if '(A) = 0 or '(B) = 1 and 0 otherwise, '(A, B) = 1 if '(A) = '(B) and 0 otherwise, RR n 2708 18 Gilles Dowek '(8x A) = 1 if for every a in MT (where T is the type of x), '+ (x; a)(A) = 1 and 0 otherwise, '(9x A) = 1 if there exists a in MT (where T is the type of x) such that '+ (x; a)(A) = 1 and 0 otherwise. Remark The notion of model of a higher order language can be used also to study stronger theories (with the descriptions axiom, the axiom of choice, the axiom of in nity, axioms of higher order arithmetic, etc.) and weaker theories (dropping extensionality, multiple truth values, etc.). For instance to show the independence of the extensionality axiom in type theory, Andrews [5] constructs a model in which all axioms of type theory but this one are valid. This model is functional (as this condition is part of the notion of model of [5]) and thus it needs to be a non equality model (as equality functional models are model of the extensionality axiom). A slightly simpler proof can be exhibited by considering a model that is not a functional model as follows. Mo = f0; 1g M = fag M ! = ff; gg MT!U =MMT U if T 6= or U 6= A ; (f; a) = a A ; (g; a) = a AT;U (x; y) = x(y) if T 6= or U 6= Y = f1g ET is the equality on MT This result is however slightly di erent from the one of [5] as we show here the independence of the extensionality axiom from a presentation of type theory with comprehension schemes while the result of [5] shows the independence of the extensionality axiom from type theory with an explicit notation for functions based on -calculus, and the equivalence of the two formulations of type theory seems to require the extensionality axiom [14]. 2.3.3 Higher-order skolemization (Miller's theorem) In rst order logic, Skolem's theorem expresses the fact that if we replace in a theory an axiom of the form 8x1 ::: 8xn 9y P by the proposition 8x1 ::: 8xn P [y (f x1 ::: xn)] where f is a new function symbol, i.e. a function symbol that does not occur in the theory, we get a conservative extension of the theory, i.e. the propositions with no occurrence of f are provable in one theory if and only if they are provable in the other. If we try to generalize this theorem to type theory, letting f be a primitive symbol of type T1 ! ::: ! Tn ! U , where Ti is the type of xi and U the type of y, then the theorem is false. Indeed, the axiom of choice is not provable in type theory [4], but its skolemized form is. In [36, 37] Miller proposes a Skolem-like theorem for type theory: the symbol f is a Skolem's symbol of arity n. Whenever a Skolem's symbol f of arity n occurs in a term it must occur in a subterm of the form (f a1 ::: an) and the free variables of the ai's cannot be bound higher in the term. In a presentation of type theory, based on combinators, there are no bound variables and thus Miller's condition simpli es to the fact that f of arity n must occur only in subterms of the form (f a1 ::: an). Inria Collections, sets and types 19 In the rst order presentation of type theory with combinators (obtained by skolemizing the comprehension schemes [14]) we can deduce this result from Skolem's theorem. Indeed, if we skolemize an axiom 8x1 ::: 8xn 9y P we introduce a function symbol f of rank (T1; :::; Tn; U), and not a primitive symbol of type T1 ! ::: ! Tn ! U . Thus the symbol f alone is not a term, but it must be applied to some terms a1; :::; an to give a term. 3 Type theory as an untyped rst order theory 3.1 Coding typed rst order theories into untyped ones Let us consider a typed rst order language. We construct an ordinary rst order language as follows [20, 15]: to each function symbol f we associate a function symbol f 0 with the same arity, to each predicate symbol P we associate a predicate symbol P 0 with the same arity, to each type T we associate a unary predicate symbol TT . We translate terms and propositions as follows. x0 = x, (f t1 ::: tn)0 = (f 0 t01 ::: t0n), (P t1 ::: tn)0 = (P 0 t01 ::: t0n), >0 = >, ?0 = ?, (:A)0 = :A0, (A ^B)0 = A0 ^ B0, (A _B)0 = A0 _ B0, (A) B)0 = A0 ) B0, (A, B)0 = A0 , B0, (8x A)0 = 8x (TT (x)) A0) where T is the type of x, (9x A)0 = 9x (TT (x) ^ A0) where T is the type of x. We translate a theory by translating each axiom, and adding the following axioms. 9x (TT x) 8x1 ::: 8xn (((TT1 x1) ^ ::: ^ (TTn xn))) (TTn+1 (f 0x1 ::: xn))) if f is a function symbol of rank (T1; :::; Tn; Tn+1). Proposition Let be a typed rst order theory and 0 its translation (i.e. the translation of its axioms plus the axioms above). The theory has a model if and only if 0 has a model. Proof See [15]. Corollary ` P if and only if 0 ` P 0. RR n 2708 20 Gilles Dowek 3.2 Translation of the axioms of type theory 3.2.1 Translation of the axioms of type theory Comprehension: 9A (TT1!:::!Tn!o A)^8x1 ::: 8xn ((TT1 x1)^:::^(TTn xn))) (" ( Tn;o ::: ( T1;T2!:::!Tn!o A x1) ::: xn)), P 9f (TT1!:::!Tn!U f)^ 8x1 ::: 8xn ((TT1 x1)^:::^(TTn xn))) ( Tn;U ::: ( T1;T2!:::!Tn!U f x1) ::: xn)) =U t Extensionality: 8P 8Q ((To P ) ^ (To Q))) ((" P ), (" Q))) (P =o Q) 8f 8g ((TT!U f) ^ (TT!U g))) (8x (TT x)) ( T;U f x) =U ( T;U g x))) (f =T!U g) Equality: 8x (TT x)) (x =T x) 8x1 ::: 8xn 8a 8b (("(TU1x1)) ^ ::: ^ ("(TUnxn)) ^ (TT a) ^ (TT b))) (a =T b)) (P [x a]) P [x b]) Typing: 8x 8y ((TT!U x) ^ (TT y))) (TU ( T;U (x; y))) Non empty: 9x (T x) Where a =T b is an abbreviation for (" ( T;o ( T;T!o =T a) b)) Remark This translation is an extension of the one of [42] where a fragment of type theory without functions and with only unary sets is translated in an untyped setting. Remark In the axioms schemes the schematic variables represent translations of propositions and terms of the typed language and not any proposition and term in the translated language. Remark The axiom 9x (TT x) is subsumed by the comprehension schemes and the non emptyness axiom for the type . RemarkWe have seen that there are two ways to restrict na ve set theory to avoid Russell's paradox. Either we restrict the formation of propositions from objects (type theory) or we restrict the formation of objects from propositions (set theory). When we translate type theory into an untyped setting we shift from one restriction to the other, indeed the formation of proposition is not restricted anymore, but the relativization of quanti er restricts the comprehension schemes. Relativization of quanti ers shows that, as already remarked in [42, 18], the two ways to avoid Russell's paradox: restricting the formation of propositions from objects (as in type theory) and restricting the formation of objects from propositions (as in set theory) lead to a somehow similar result. 3.2.2 A single symbol for application From the theory above, we remove the symbols T;U and we add a symbol . We then de ne the translation from a theory to the other, by replacing every T;U by .
منابع مشابه
General definitions for the union and intersection of ordered fuzzy multisets
Since its original formulation, the theory of fuzzy sets has spawned a number of extensions where the role of membership values in the real unit interval $[0, 1]$ is handed over to more complex mathematical entities. Amongst the many existing extensions, two similar ones, the fuzzy multisets and the hesitant fuzzy sets, rely on collections of several distinct values to represent fuzzy membershi...
متن کاملتحلیل بحران برپایۀ سنجش عوامل مؤثر بر خوردگی فعال و ارزیابی بحران در مجموعههای برنزی باستانی
Recently risk assessment and management in cultural-historical collections is one of the important subjects in the field of preventive conservation research. Different methods and aspects of are used and studied in the field of risk assessment in archaeological sites and collections and significant results are achieved and published in last decades. One of the types of archaeological collection...
متن کاملA note on approximation conditions, standard triangularizability and a power set topology
The main result of this article is that for collections of entry-wise non-negative matrices the property of possessing a standard triangularization is stable under approximation. The methodology introduced to prove this result allows us to offer quick proofs of the corresponding results of [B. R. Yahaghi, Near triangularizability implies triangularizability, Canad. Math. Bull. 47, (2004), no. 2...
متن کاملCollections of Objects in SQL3
SQL3 generalizes the relational model into an object model offering abstract data types, multiple inheritance, and dynamic polymorphism. Tables may then contain collections (multisets) of objects, and sets and lists are defined as closely related collection types. By specifying an SQL-Table type template to correspond to the existing Table concept, it is possible to treat sets and lists as subt...
متن کاملThe Maximum Piercing Number for some Classes of Convex Sets with the (4, 3)-property
A finite collection C of closed convex sets in R is said to have a (p, q)-property if among any p members of C some q have a non-empty intersection, and |C| ≥ p. A piercing number of C is defined as the minimal number k such that there exists a k-element set which intersects every member of C. We focus on the simplest non-trivial case in R, i.e., p = 4 and q = 3. It is known that the maximum po...
متن کاملModeling Collections in UML and ORM
Collection types such as sets, bags and arrays have been used as data structures in both traditional and object oriented programming. Although sets were used as record components in early database work, this practice was largely discontinued with the widespread adoption of relational databases. Object-relational and object databases once again allow database designers to embed collections as da...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- Mathematical Structures in Computer Science
دوره 9 شماره
صفحات -
تاریخ انتشار 1999